#include "citymanager.h"
#include "QDebug"
#include "setting.h"
#include "bean/rolebean.h"
#include "bean/cityxiaoweibean.h"

Q_GLOBAL_STATIC(CityManager,instance)
CityManager::CityManager(QObject *parent) : QObject(parent)
{

    //    initData();
    initMatrix();
    generateCityNode();
}

CityManager *CityManager::getInstance()
{
    return instance();
}

void CityManager::generateCityNode(){
    CityNode *qiongzhou = new CityNode("琼州", "qiongzhou");
    CityNode *qiongzhou_nanhai = new CityNode("南海", "nanhai",279, 286 );
    qiongzhou_nanhai->xiaoweis->append(new CityXiaoWeiBean(292, 58, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    qiongzhou_nanhai->xiaoweis->append(new CityXiaoWeiBean(108, 227, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    qiongzhou_nanhai->xiaoweis->append(new CityXiaoWeiBean(134, 40, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    qiongzhou->nextCitys->append(qiongzhou_nanhai);
    qiongzhou->xiaoweis->append(new CityXiaoWeiBean(273, 52, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    qiongzhou->xiaoweis->append(new CityXiaoWeiBean(243, 150, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    qiongzhou->xiaoweis->append(new CityXiaoWeiBean(80, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(qiongzhou);

    CityNode *nanhai = new CityNode("南海", "nanhai");
    nanhai->nextCitys->append(new CityNode("海贼洞", "haizeidong", 70, 188));
    CityNode *nanhai_qiongzhou = new CityNode("琼州", "qiongzhou", 286, 174);
    nanhai_qiongzhou->xiaoweis->append(new CityXiaoWeiBean(273, 52, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    nanhai_qiongzhou->xiaoweis->append(new CityXiaoWeiBean(243, 150, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    nanhai_qiongzhou->xiaoweis->append(new CityXiaoWeiBean(80, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    nanhai->nextCitys->append(nanhai_qiongzhou);
    CityNode*nanhai_wuyi = new CityNode("武夷", "wuyi", 34, 36);
    nanhai_wuyi->xiaoweis->append(new CityXiaoWeiBean(254, 38, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    nanhai_wuyi->xiaoweis->append(new CityXiaoWeiBean(113, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    nanhai_wuyi->xiaoweis->append(new CityXiaoWeiBean(92, 172, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    nanhai->nextCitys->append(nanhai_wuyi);
    nanhai->xiaoweis->append(new CityXiaoWeiBean(292, 58, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    nanhai->xiaoweis->append(new CityXiaoWeiBean(108, 227, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    nanhai->xiaoweis->append(new CityXiaoWeiBean(134, 40, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    allCitys->append(nanhai);

    CityNode *haizeidong = new CityNode("海贼洞", "haizeidong");
    allCitys->append(haizeidong);

    CityNode *taihu = new CityNode("太湖", "taihu");
    taihu->nextCitys->append(new CityNode("丐帮总舵", "gaibang",280,32));
    taihu->nextCitys->append(new CityNode("光明殿", "mingjiao",286,230));
    taihu->nextCitys->append(new CityNode("嵩山", "songshan", 91,23));
    taihu->nextCitys->append(new CityNode("苏州", "suzhou", 215,281));
    allCitys->append(taihu);

    CityNode *gaibang = new CityNode("丐帮总舵", "gaibang");
    gaibang->nextCitys->append(new CityNode("太湖", "taihu", 91, 158));
    allCitys->append(gaibang);

    CityNode *mingjiao = new CityNode("光明殿", "mingjiao");
    mingjiao->nextCitys->append(new CityNode("太湖", "taihu", 97, 173));
    allCitys->append(mingjiao);

    CityNode *songshan = new CityNode("嵩山", "songshan");
    songshan->nextCitys->append(new CityNode("洛阳", "luoyang", 34,55));
    songshan->nextCitys->append(new CityNode("少林寺", "shaolin", 285,135));
    songshan->nextCitys->append(new CityNode("太湖", "taihu", 286,247));
    allCitys->append(songshan);

    CityNode *shaolin = new CityNode("少林寺", "shaolin");
    songshan->nextCitys->append(new CityNode("嵩山", "songshan", 96, 156));
    allCitys->append(shaolin);

    CityNode *suzhou = new CityNode("苏州", "suzhou");
    suzhou->nextCitys->append(new CityNode("镜湖", "jinghu", 32, 162));
    suzhou->nextCitys->append(new CityNode("太湖", "taihu", 181, 33));
    CityNode *suzhou_xihu = new CityNode("西湖", "xihu", 182, 287);
    suzhou_xihu->xiaoweis->append(new CityXiaoWeiBean(45, 267, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    suzhou_xihu->xiaoweis->append(new CityXiaoWeiBean(261, 231, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    suzhou_xihu->xiaoweis->append(new CityXiaoWeiBean(39, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    suzhou->nextCitys->append(suzhou_xihu);
    allCitys->append(suzhou);

    CityNode *jinghu = new CityNode("镜湖", "jinghu");
    jinghu->nextCitys->append(new CityNode("苏州", "suzhou", 285, 44));
    jinghu->nextCitys->append(new CityNode("无量山", "wuliang", 38, 284));
    jinghu->nextCitys->append(new CityNode("武当山", "wudang", 29,232));
    allCitys->append(jinghu);

    CityNode *xihu = new CityNode("西湖", "xihu");
    CityNode *xihu_longquan= new CityNode("龙泉", "longquan", 287, 54);
    xihu_longquan->xiaoweis->append(new CityXiaoWeiBean(218, 282, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    xihu_longquan->xiaoweis->append(new CityXiaoWeiBean(63, 33, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    xihu_longquan->xiaoweis->append(new CityXiaoWeiBean(35, 121, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    xihu->nextCitys->append(xihu_longquan);
    xihu->nextCitys->append(new CityNode("山洞船坞", "chuanwu", 42, 227));
    xihu->nextCitys->append(new CityNode("苏州", "suzhou", 34, 50));
    CityNode *xihu_wuyi = new CityNode("武夷", "wuyi", 265, 286);
    xihu_wuyi->xiaoweis->append(new CityXiaoWeiBean(254, 38, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    xihu_wuyi->xiaoweis->append(new CityXiaoWeiBean(113, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    xihu_wuyi->xiaoweis->append(new CityXiaoWeiBean(92, 172, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    xihu->nextCitys->append(xihu_wuyi);
    xihu->nextCitys->append(new CityNode("夜西湖", "xihu_1", 91, 45));
    xihu->xiaoweis->append(new CityXiaoWeiBean(45, 267, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    xihu->xiaoweis->append(new CityXiaoWeiBean(261, 231, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    xihu->xiaoweis->append(new CityXiaoWeiBean(39, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(xihu);

    CityNode *longquan = new CityNode("龙泉", "longquan");
    longquan->nextCitys->append(new CityNode("剑冢", "jianzhong",172, 280));
    CityNode *longquan_xihu = new CityNode("西湖", "xihu", 34, 274);
    longquan_xihu->xiaoweis->append(new CityXiaoWeiBean(45, 267, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    longquan_xihu->xiaoweis->append(new CityXiaoWeiBean(261, 231, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    longquan_xihu->xiaoweis->append(new CityXiaoWeiBean(39, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    longquan->nextCitys->append(longquan_xihu);
    longquan->nextCitys->append(new CityNode("清源", "quanzhou", 284, 154));
    longquan->xiaoweis->append(new CityXiaoWeiBean(218, 282, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    longquan->xiaoweis->append(new CityXiaoWeiBean(63, 33, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    longquan->xiaoweis->append(new CityXiaoWeiBean(35, 121, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(longquan);

    CityNode *chuanwu = new CityNode("山洞船坞", "chuanwu");
    CityNode *chuanwu_xihu = new CityNode("西湖", "xihu", 34, 274);
    chuanwu_xihu->xiaoweis->append(new CityXiaoWeiBean(45, 267, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    chuanwu_xihu->xiaoweis->append(new CityXiaoWeiBean(261, 231, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    chuanwu_xihu->xiaoweis->append(new CityXiaoWeiBean(39, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    chuanwu->nextCitys->append(chuanwu_xihu);
    allCitys->append(chuanwu);

    CityNode *yexihu = new CityNode("夜西湖", "xihu_1");
    CityNode *yexihu_xihu = new CityNode("西湖", "xihu", 34, 274);
    yexihu_xihu->xiaoweis->append(new CityXiaoWeiBean(45, 267, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    yexihu_xihu->xiaoweis->append(new CityXiaoWeiBean(261, 231, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    yexihu_xihu->xiaoweis->append(new CityXiaoWeiBean(39, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    yexihu->nextCitys->append(yexihu_xihu);
    allCitys->append(yexihu);

    CityNode *wuyi = new CityNode("武夷", "wuyi");
    wuyi->nextCitys->append(new CityNode("黄龙洞", "huanglongdong", 96, 44));
    CityNode *wuyi_meiling = new CityNode("梅岭", "meiling", 283, 180);
    wuyi_meiling->xiaoweis->append(new CityXiaoWeiBean(271, 37, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    wuyi_meiling->xiaoweis->append(new CityXiaoWeiBean(31, 90, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    wuyi_meiling->xiaoweis->append(new CityXiaoWeiBean(282, 236, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    wuyi->nextCitys->append(wuyi_meiling);
    CityNode *wuyi_nanhai = new CityNode("南海", "nanhai", 248, 286);
    wuyi_nanhai->xiaoweis->append(new CityXiaoWeiBean(292, 58, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    wuyi_nanhai->xiaoweis->append(new CityXiaoWeiBean(108, 227, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    wuyi_nanhai->xiaoweis->append(new CityXiaoWeiBean(134, 40, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    wuyi->nextCitys->append(wuyi_nanhai);
    CityNode *wuyi_xihu= new CityNode("西湖", "xihu", 36, 33);
    wuyi_xihu->xiaoweis->append(new CityXiaoWeiBean(45, 267, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    wuyi_xihu->xiaoweis->append(new CityXiaoWeiBean(261, 231, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    wuyi_xihu->xiaoweis->append(new CityXiaoWeiBean(39, 139, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    wuyi->nextCitys->append(wuyi_xihu);
    wuyi->xiaoweis->append(new CityXiaoWeiBean(254, 38, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    wuyi->xiaoweis->append(new CityXiaoWeiBean(113, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    wuyi->xiaoweis->append(new CityXiaoWeiBean(92, 172, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(wuyi);

    CityNode *huanglongdong = new CityNode("黄龙洞", "huanglongdong");
    CityNode *huanglongdong_wuyi = new CityNode("武夷", "wuyi", 108, 229);
    huanglongdong_wuyi->xiaoweis->append(new CityXiaoWeiBean(254, 38, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    huanglongdong_wuyi->xiaoweis->append(new CityXiaoWeiBean(113, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    huanglongdong_wuyi->xiaoweis->append(new CityXiaoWeiBean(92, 172, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    huanglongdong->nextCitys->append(huanglongdong_wuyi);
    allCitys->append(huanglongdong);

    CityNode *meiling = new CityNode("梅岭", "meiling");
    meiling->nextCitys->append(new CityNode("苗人洞","miaorendong", 192, 279));
    CityNode *meiling_wuyi = new CityNode("武夷","wuyi", 33, 275);
    meiling_wuyi->xiaoweis->append(new CityXiaoWeiBean(254, 38, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    meiling_wuyi->xiaoweis->append(new CityXiaoWeiBean(113, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    meiling_wuyi->xiaoweis->append(new CityXiaoWeiBean(92, 172, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    meiling->nextCitys->append(meiling_wuyi);
    meiling->nextCitys->append(new CityNode("清源","quanzhou", 276, 29));
    meiling->xiaoweis->append(new CityXiaoWeiBean(271, 37, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    meiling->xiaoweis->append(new CityXiaoWeiBean(31, 90, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    meiling->xiaoweis->append(new CityXiaoWeiBean(282, 236, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    allCitys->append(meiling);

    CityNode *yannan = new CityNode("雁南", "yannan");
    CityNode *yannan_caoyuan = new CityNode("草原","caoyuan", 33, 58);
    yannan_caoyuan->xiaoweis->append(new CityXiaoWeiBean(97, 281, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    yannan_caoyuan->xiaoweis->append(new CityXiaoWeiBean(271, 191, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    yannan_caoyuan->xiaoweis->append(new CityXiaoWeiBean(66, 202, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    yannan->nextCitys->append(yannan_caoyuan);
    yannan->nextCitys->append(new CityNode("洛阳","luoyang", 264, 286));
    yannan->nextCitys->append(new CityNode("摩崖洞","moyadong", 34, 39));
    CityNode *yannan_yanbei = new CityNode("雁北","yanbei", 248, 37);
    yannan_yanbei->xiaoweis->append(new CityXiaoWeiBean(234, 24, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    yannan_yanbei->xiaoweis->append(new CityXiaoWeiBean(116, 29, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    yannan_yanbei->xiaoweis->append(new CityXiaoWeiBean(32, 128, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    yannan->nextCitys->append(yannan_yanbei);
    yannan->xiaoweis->append(new CityXiaoWeiBean(102, 36, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    yannan->xiaoweis->append(new CityXiaoWeiBean(283, 113, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    yannan->xiaoweis->append(new CityXiaoWeiBean(72, 284, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    allCitys->append(yannan);

    CityNode *luoyang = new CityNode("洛阳", "luoyang");
    luoyang->nextCitys->append(new CityNode("敦煌","dunhuang", 33,130));
    luoyang->nextCitys->append(new CityNode("嵩山","songshan", 159,287));
    CityNode *luoyang_yannan = new CityNode("雁南","yannan", 286,129);
    luoyang_yannan->xiaoweis->append(new CityXiaoWeiBean(102, 36, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    luoyang_yannan->xiaoweis->append(new CityXiaoWeiBean(283, 113, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    luoyang_yannan->xiaoweis->append(new CityXiaoWeiBean(72, 284, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    luoyang->nextCitys->append(luoyang_yannan);
    allCitys->append(luoyang);

    CityNode *dunhuang = new CityNode("敦煌", "dunhuang");
    dunhuang->nextCitys->append(new CityNode("宝藏洞","baozang_1", 149, 38));
    dunhuang->nextCitys->append(new CityNode("剑阁","jiange", 231, 286));
    dunhuang->nextCitys->append(new CityNode("洛阳","luoyang", 284, 146));
    dunhuang->nextCitys->append(new CityNode("天山","tianshan", 55, 34));
    dunhuang->nextCitys->append(new CityNode("星宿海","xingxiu", 33, 277));
    allCitys->append(dunhuang);


    CityNode *quanzhou = new CityNode("清源", "quanzhou");
    CityNode *quanzhou_longquan = new CityNode("龙泉","longquan", 280, 45);
    quanzhou_longquan->xiaoweis->append(new CityXiaoWeiBean(218, 282, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    quanzhou_longquan->xiaoweis->append(new CityXiaoWeiBean(63, 33, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    quanzhou_longquan->xiaoweis->append(new CityXiaoWeiBean(35, 121, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    quanzhou->nextCitys->append(quanzhou_longquan);
    CityNode *quanzhou_meiling = new CityNode("梅岭","meiling", 103, 303);
    quanzhou_meiling->xiaoweis->append(new CityXiaoWeiBean(271, 37, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    quanzhou_meiling->xiaoweis->append(new CityXiaoWeiBean(31, 90, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    quanzhou_meiling->xiaoweis->append(new CityXiaoWeiBean(282, 236, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    quanzhou->nextCitys->append(quanzhou_meiling);
    quanzhou->nextCitys->append(new CityNode("清源山洞","quanzhoushandong", 283, 293));
    allCitys->append(quanzhou);

    CityNode *quanzhoudong = new CityNode("清源山洞", "quanzhoushandong");
    quanzhoudong->nextCitys->append(new CityNode("清源","quanzhou", 42, 228));
    allCitys->append(quanzhoudong);

    CityNode *jianzhong = new CityNode("剑冢", "jianzhong");
    CityNode *jianzhong_longquan = new CityNode("龙泉","longquan", 15, 15);
    jianzhong_longquan->xiaoweis->append(new CityXiaoWeiBean(218, 282, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    jianzhong_longquan->xiaoweis->append(new CityXiaoWeiBean(63, 33, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    jianzhong_longquan->xiaoweis->append(new CityXiaoWeiBean(35, 121, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    jianzhong->nextCitys->append(jianzhong_longquan);
    allCitys->append(jianzhong);

    CityNode *wuliang = new CityNode("无量山", "wuliang");
    wuliang->nextCitys->append(new CityNode("大理","dali", 32, 176));
    wuliang->nextCitys->append(new CityNode("镜湖","jinghu", 287, 77));
    wuliang->nextCitys->append(new CityNode("凌波洞","xiaoyao", 116, 32));
    wuliang->nextCitys->append(new CityNode("天龙寺","tianlong", 94, 286));
    allCitys->append(wuliang);

    CityNode *dali = new CityNode("大理", "dali");
    CityNode *dali_erhai = new CityNode("洱海","erhai", 159, 287);
    dali_erhai->xiaoweis->append(new CityXiaoWeiBean(285, 166, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    dali_erhai->xiaoweis->append(new CityXiaoWeiBean(173, 283, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    dali_erhai->xiaoweis->append(new CityXiaoWeiBean(34, 100, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    dali->nextCitys->append(dali_erhai);
    dali->nextCitys->append(new CityNode("剑阁","jiange", 31, 151));
    dali->nextCitys->append(new CityNode("无量山","wuliang", 288, 151));
    allCitys->append(dali);


    CityNode *xiaoyao = new CityNode("凌波洞", "xiaoyao");
    xiaoyao->nextCitys->append(new CityNode("无量山","wuliang", 37, 130));
    allCitys->append(xiaoyao);

    CityNode *tianlong = new CityNode("天龙寺", "tianlong");
    tianlong->nextCitys->append(new CityNode("无量山","wuliang",95, 145));
    allCitys->append(tianlong);


    CityNode *erhai = new CityNode("洱海", "erhai");
    CityNode *erhai_cangshan = new CityNode("苍山","cangshan",34, 157);
    erhai_cangshan->xiaoweis->append(new CityXiaoWeiBean(37, 172, "正西校尉" ,":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    erhai_cangshan->xiaoweis->append(new CityXiaoWeiBean(294, 153, "正东校尉" ,":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    erhai_cangshan->xiaoweis->append(new CityXiaoWeiBean(146, 284, "正南校尉" ,":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    erhai->nextCitys->append(erhai_cangshan);
    erhai->nextCitys->append(new CityNode("大理","dali", 287, 32));
    CityNode *erhai_shilin = new CityNode("石林","shilin", 34, 279);
    erhai_shilin->xiaoweis->append(new CityXiaoWeiBean(226, 36, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    erhai_shilin->xiaoweis->append(new CityXiaoWeiBean(278, 281, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    erhai_shilin->xiaoweis->append(new CityXiaoWeiBean(45, 177, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    erhai->nextCitys->append(erhai_shilin);
    erhai->nextCitys->append(new CityNode("温泉洞","wenquandong", 284, 87));
    erhai->xiaoweis->append(new CityXiaoWeiBean(285, 166, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    erhai->xiaoweis->append(new CityXiaoWeiBean(173, 283, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    erhai->xiaoweis->append(new CityXiaoWeiBean(34, 100, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(erhai);

    CityNode *jiange = new CityNode("剑阁", "jiange");
    jiange->nextCitys->append(new CityNode("大理","dali", 36, 286));
    jiange->nextCitys->append(new CityNode("敦煌","dunhuang", 105, 40));
    jiange->nextCitys->append(new CityNode("峨眉山","emei", 185, 172));
    allCitys->append(jiange);


    CityNode *cangshan = new CityNode("苍山", "cangshan");
    CityNode *cangshan_erhai = new CityNode("洱海","erhai", 286, 56);
    cangshan_erhai->xiaoweis->append(new CityXiaoWeiBean(285, 166, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    cangshan_erhai->xiaoweis->append(new CityXiaoWeiBean(173, 283, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    cangshan_erhai->xiaoweis->append(new CityXiaoWeiBean(34, 100, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    cangshan->nextCitys->append(cangshan_erhai);
    cangshan->nextCitys->append(new CityNode("野人沟","yerengou", 278, 122));
    cangshan->xiaoweis->append(new CityXiaoWeiBean(37, 172, "正西校尉" ,":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    cangshan->xiaoweis->append(new CityXiaoWeiBean(294, 153, "正东校尉" ,":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    cangshan->xiaoweis->append(new CityXiaoWeiBean(146, 284, "正南校尉" ,":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    allCitys->append(cangshan);

    CityNode *shilin = new CityNode("石林", "shilin");
    CityNode *shilin_erhai = new CityNode("洱海","erhai", 268, 128);
    shilin_erhai->xiaoweis->append(new CityXiaoWeiBean(285, 166, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    shilin_erhai->xiaoweis->append(new CityXiaoWeiBean(173, 283, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    shilin_erhai->xiaoweis->append(new CityXiaoWeiBean(34, 100, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    shilin->nextCitys->append(shilin_erhai);
    CityNode *shilin_nanzhao = new CityNode("南诏","nanzhao", 33, 250);
    shilin_nanzhao->xiaoweis->append(new CityXiaoWeiBean(96, 42, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    shilin_nanzhao->xiaoweis->append(new CityXiaoWeiBean(272, 240, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    shilin_nanzhao->xiaoweis->append(new CityXiaoWeiBean(39, 254, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    shilin->nextCitys->append(shilin_nanzhao);
    shilin->nextCitys->append(new CityNode("树洞","shudong", 109, 272));
    shilin->nextCitys->append(new CityNode("盐湖","yanhu", 37, 273));
    CityNode *shilin_yuxi = new CityNode("玉溪","yuxi", 112, 34);
    shilin_yuxi->xiaoweis->append(new CityXiaoWeiBean(33, 251, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    shilin_yuxi->xiaoweis->append(new CityXiaoWeiBean(177, 39, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    shilin_yuxi->xiaoweis->append(new CityXiaoWeiBean(197, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    shilin->nextCitys->append(shilin_yuxi);
    shilin->xiaoweis->append(new CityXiaoWeiBean(226, 36, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    shilin->xiaoweis->append(new CityXiaoWeiBean(278, 281, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    shilin->xiaoweis->append(new CityXiaoWeiBean(45, 177, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(shilin);

    CityNode *wenquandong = new CityNode("温泉洞", "wenquandong");
    CityNode *wenquandong_erhai = new CityNode("洱海","erhai", 25, 235);
    wenquandong_erhai->xiaoweis->append(new CityXiaoWeiBean(285, 166, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    wenquandong_erhai->xiaoweis->append(new CityXiaoWeiBean(173, 283, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    wenquandong_erhai->xiaoweis->append(new CityXiaoWeiBean(34, 100, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    wenquandong->nextCitys->append(wenquandong_erhai);
    allCitys->append(wenquandong);

    CityNode *yerengou = new CityNode("野人沟", "yerengou");
    CityNode *yerengou_cangshan = new CityNode("苍山","cangshan", 21, 36);
    yerengou_cangshan->xiaoweis->append(new CityXiaoWeiBean(37, 172, "正西校尉" ,":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    yerengou_cangshan->xiaoweis->append(new CityXiaoWeiBean(294, 153, "正东校尉" ,":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    yerengou_cangshan->xiaoweis->append(new CityXiaoWeiBean(146, 284, "正南校尉" ,":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    yerengou->nextCitys->append(yerengou_cangshan);
    allCitys->append(yerengou);


    CityNode *caoyuan = new CityNode("草原", "caoyuan");
    CityNode *caoyuan_changbai = new CityNode("长白山","changbai", 271, 33);
    caoyuan_changbai->xiaoweis->append(new CityXiaoWeiBean(216, 282, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    caoyuan_changbai->xiaoweis->append(new CityXiaoWeiBean(39, 63, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    caoyuan_changbai->xiaoweis->append(new CityXiaoWeiBean(280, 154, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    caoyuan->nextCitys->append(caoyuan_changbai);
    CityNode *caoyuan_liaoxi = new CityNode("辽西","liaoxi", 119, 32);
    caoyuan_liaoxi->xiaoweis->append(new CityXiaoWeiBean(277, 258, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    caoyuan_liaoxi->xiaoweis->append(new CityXiaoWeiBean(75, 35, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    caoyuan_liaoxi->xiaoweis->append(new CityXiaoWeiBean(40, 142, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    caoyuan->nextCitys->append(caoyuan_liaoxi);
    caoyuan->nextCitys->append(new CityNode("水晶湖","shuijinghu", 65, 195));
    CityNode *caoyuan_yannan =  new CityNode("雁南","yannan", 287, 258);
    caoyuan_yannan->xiaoweis->append(new CityXiaoWeiBean(102, 36, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    caoyuan_yannan->xiaoweis->append(new CityXiaoWeiBean(283, 113, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    caoyuan_yannan->xiaoweis->append(new CityXiaoWeiBean(72, 284, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    caoyuan->nextCitys->append(caoyuan_yannan);
    caoyuan->xiaoweis->append(new CityXiaoWeiBean(97, 281, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    caoyuan->xiaoweis->append(new CityXiaoWeiBean(271, 191, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    caoyuan->xiaoweis->append(new CityXiaoWeiBean(66, 202, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(caoyuan);

    CityNode *moyadong = new CityNode("摩崖洞", "moyadong");
    CityNode *moyadong_yannan = new CityNode("雁南","yannan", 22, 235);
    moyadong_yannan->xiaoweis->append(new CityXiaoWeiBean(102, 36, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    moyadong_yannan->xiaoweis->append(new CityXiaoWeiBean(283, 113, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    moyadong_yannan->xiaoweis->append(new CityXiaoWeiBean(72, 284, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    moyadong->nextCitys->append(moyadong_yannan);
    allCitys->append(moyadong);


    CityNode *yanbei = new CityNode("雁北", "yanbei");
    yanbei->nextCitys->append(new CityNode("草料场","caoliaochang", 59, 60));
    yanbei->nextCitys->append(new CityNode("古墓","gumu", 139, 259));
    CityNode *yanbei_yannan = new CityNode("雁南","yannan", 228, 280);
    yanbei_yannan->xiaoweis->append(new CityXiaoWeiBean(102, 36, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    yanbei_yannan->xiaoweis->append(new CityXiaoWeiBean(283, 113, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    yanbei_yannan->xiaoweis->append(new CityXiaoWeiBean(72, 284, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    yanbei->nextCitys->append(yanbei_yannan);
    yanbei->xiaoweis->append(new CityXiaoWeiBean(234, 24, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    yanbei->xiaoweis->append(new CityXiaoWeiBean(116, 29, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    yanbei->xiaoweis->append(new CityXiaoWeiBean(32, 128, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(yanbei);


    CityNode *bashu_1 = new CityNode("燕王古墓", "bashu_1");
    CityNode *bashu_1_yanbei = new CityNode("雁北","yanbei", 69, 104);
    bashu_1_yanbei->xiaoweis->append(new CityXiaoWeiBean(234, 24, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    bashu_1_yanbei->xiaoweis->append(new CityXiaoWeiBean(116, 29, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    bashu_1_yanbei->xiaoweis->append(new CityXiaoWeiBean(32, 128, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    bashu_1->nextCitys->append(bashu_1_yanbei);
    allCitys->append(bashu_1);

    CityNode *caoliao = new CityNode("草料场", "caoliao");
    CityNode *caoliao_yanbei = new CityNode("雁北","yanbei", 23, 228);
    caoliao_yanbei->xiaoweis->append(new CityXiaoWeiBean(234, 24, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    caoliao_yanbei->xiaoweis->append(new CityXiaoWeiBean(116, 29, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    caoliao_yanbei->xiaoweis->append(new CityXiaoWeiBean(32, 128, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    caoliao->nextCitys->append(caoliao_yanbei);
    allCitys->append(caoliao);

    CityNode *shuijinghu = new CityNode("水晶湖", "shuijinghu");
    CityNode *shuijinghu_caoyuan = new CityNode("草原","caoyuan", 230, 236);
    shuijinghu_caoyuan->xiaoweis->append(new CityXiaoWeiBean(97, 281, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    shuijinghu_caoyuan->xiaoweis->append(new CityXiaoWeiBean(271, 191, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    shuijinghu_caoyuan->xiaoweis->append(new CityXiaoWeiBean(66, 202, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    shuijinghu->nextCitys->append(shuijinghu_caoyuan);
    allCitys->append(shuijinghu);


    CityNode *changbai = new CityNode("长白山", "changbai");
    CityNode *changbai_caoyuan = new CityNode("草原","caoyuan", 33, 269);
    changbai_caoyuan->xiaoweis->append(new CityXiaoWeiBean(97, 281, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    changbai_caoyuan->xiaoweis->append(new CityXiaoWeiBean(271, 191, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    changbai_caoyuan->xiaoweis->append(new CityXiaoWeiBean(66, 202, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    changbai->nextCitys->append(changbai_caoyuan);
    changbai->nextCitys->append(new CityNode("黄龙府", "huanglong",286, 73));
    changbai->xiaoweis->append(new CityXiaoWeiBean(216, 282, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    changbai->xiaoweis->append(new CityXiaoWeiBean(39, 63, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    changbai->xiaoweis->append(new CityXiaoWeiBean(280, 154, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    allCitys->append(changbai);

    CityNode *huanglong = new CityNode("黄龙府", "huanglong");
    CityNode *huanglong_changbai = new CityNode("长白山","changbai", 48, 287);
    huanglong_changbai->xiaoweis->append(new CityXiaoWeiBean(216, 282, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    huanglong_changbai->xiaoweis->append(new CityXiaoWeiBean(39, 63, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    huanglong_changbai->xiaoweis->append(new CityXiaoWeiBean(280, 154, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    huanglong->nextCitys->append(huanglong_changbai);
    huanglong->nextCitys->append(new CityNode("雪狼湖","xuelanghu", 201, 255));
    huanglong->xiaoweis->append(new CityXiaoWeiBean(253, 285, "东南校尉",":/runshop/icon/runshop/xiaowei_dongnan.png"));
    huanglong->xiaoweis->append(new CityXiaoWeiBean(28, 54, "西北校尉",":/runshop/icon/runshop/xiaowei_xibei.png"));
    huanglong->xiaoweis->append(new CityXiaoWeiBean(290, 115, "正东校尉",":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    allCitys->append(huanglong);

    CityNode *xuelanghu = new CityNode("雪狼湖", "xuelanghu");
    xuelanghu->nextCitys->append(new CityNode("黄龙府","huanglong", 108, 228));
    allCitys->append(xuelanghu);


    CityNode *liaoxi = new CityNode("辽西", "liaoxi");
    CityNode *liaoxi_caoyuan = new CityNode("草原","caoyuan", 61, 297);
    liaoxi_caoyuan->xiaoweis->append(new CityXiaoWeiBean(97, 281, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    liaoxi_caoyuan->xiaoweis->append(new CityXiaoWeiBean(271, 191, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    liaoxi_caoyuan->xiaoweis->append(new CityXiaoWeiBean(66, 202, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    liaoxi->nextCitys->append(liaoxi_caoyuan);
    liaoxi->nextCitys->append(new CityNode("先王坟","xianwangfen", 37, 211));
    liaoxi->nextCitys->append(new CityNode("银凯雪原","bingkang", 285, 45));
    liaoxi->xiaoweis->append(new CityXiaoWeiBean(277, 258, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    liaoxi->xiaoweis->append(new CityXiaoWeiBean(75, 35, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    liaoxi->xiaoweis->append(new CityXiaoWeiBean(40, 142, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    allCitys->append(liaoxi);

    CityNode *xianwangfen = new CityNode("先王坟", "xianwangfen");
    CityNode *xianwangfen_liaoxi = new CityNode("辽西","liaoxi", 127, 19);
    xianwangfen_liaoxi->xiaoweis->append(new CityXiaoWeiBean(277, 258, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    xianwangfen_liaoxi->xiaoweis->append(new CityXiaoWeiBean(75, 35, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    xianwangfen_liaoxi->xiaoweis->append(new CityXiaoWeiBean(40, 142, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    xianwangfen->nextCitys->append(xianwangfen_liaoxi);
    allCitys->append(xianwangfen);

    CityNode *bingkang = new CityNode("银凯雪原", "bingkang");
    CityNode *bingkang_liaoxi = new CityNode("辽西", "liaoxi", 58, 226);
    bingkang_liaoxi->xiaoweis->append(new CityXiaoWeiBean(277, 258, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    bingkang_liaoxi->xiaoweis->append(new CityXiaoWeiBean(75, 35, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    bingkang_liaoxi->xiaoweis->append(new CityXiaoWeiBean(40, 142, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    bingkang->nextCitys->append(bingkang_liaoxi);
    allCitys->append(bingkang);

    CityNode *yuxi = new CityNode("玉溪", "yuxi");
    CityNode *yuxi_shilin = new CityNode("石林","shilin", 36, 46);
    yuxi_shilin->xiaoweis->append(new CityXiaoWeiBean(226, 36, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    yuxi_shilin->xiaoweis->append(new CityXiaoWeiBean(278, 281, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    yuxi_shilin->xiaoweis->append(new CityXiaoWeiBean(45, 177, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    yuxi->nextCitys->append(yuxi_shilin);
    yuxi->nextCitys->append(new CityNode("桃花源","taohuayuan", 54, 167));
    yuxi->xiaoweis->append(new CityXiaoWeiBean(33, 251, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    yuxi->xiaoweis->append(new CityXiaoWeiBean(177, 39, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    yuxi->xiaoweis->append(new CityXiaoWeiBean(197, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    allCitys->append(yuxi);

    CityNode *taohuayuan = new CityNode("桃花源", "taohuayuan");
    CityNode *taohuayuan_yuxi = new CityNode("玉溪","yuxi", 20, 19);
    taohuayuan_yuxi->xiaoweis->append(new CityXiaoWeiBean(33, 251, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    taohuayuan_yuxi->xiaoweis->append(new CityXiaoWeiBean(177, 39, "正北校尉", ":/runshop/icon/runshop/xiaowei_zhengbei.png"));
    taohuayuan_yuxi->xiaoweis->append(new CityXiaoWeiBean(197, 280, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    taohuayuan->nextCitys->append(taohuayuan_yuxi);
    allCitys->append(taohuayuan);

    CityNode *shudong = new CityNode("天坑树洞", "shudong");
    CityNode *shudong_shilin = new CityNode("石林","shilin", 237, 18);
    shudong_shilin->xiaoweis->append(new CityXiaoWeiBean(226, 36, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    shudong_shilin->xiaoweis->append(new CityXiaoWeiBean(278, 281, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    shudong_shilin->xiaoweis->append(new CityXiaoWeiBean(45, 177, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    shudong->nextCitys->append(shudong_shilin);
    allCitys->append(shudong);

    CityNode *yanhu = new CityNode("盐湖", "yanhu");
    CityNode *yanhu_shilin = new CityNode("石林","shilin", 49, 23);
    yanhu_shilin->xiaoweis->append(new CityXiaoWeiBean(226, 36, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    yanhu_shilin->xiaoweis->append(new CityXiaoWeiBean(278, 281, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    yanhu_shilin->xiaoweis->append(new CityXiaoWeiBean(45, 177, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    yanhu->nextCitys->append(yanhu_shilin);
    yanhu->nextCitys->append(new CityNode("白沙盐坑","yankeng", 231, 169));
    allCitys->append(yanhu);

    CityNode *yankeng = new CityNode("白沙盐坑", "yankeng");
    yankeng->nextCitys->append(new CityNode("盐湖","yanhu", 100, 98));
    allCitys->append(yankeng);

    CityNode *nanzhao = new CityNode("南诏", "nanzhao");
    CityNode *nanzhao_miaojiang = new CityNode("苗疆","miaojiang", 106, 285);
    nanzhao_miaojiang->xiaoweis->append(new CityXiaoWeiBean(250, 45, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    nanzhao_miaojiang->xiaoweis->append(new CityXiaoWeiBean(37, 251, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    nanzhao_miaojiang->xiaoweis->append(new CityXiaoWeiBean(281, 160, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    nanzhao->nextCitys->append(nanzhao_miaojiang);
    CityNode *nanzhao_shilin = new CityNode("石林","shilin", 280, 45);
    nanzhao_shilin->xiaoweis->append(new CityXiaoWeiBean(226, 36, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    nanzhao_shilin->xiaoweis->append(new CityXiaoWeiBean(278, 281, "正南校尉", ":/runshop/icon/runshop/xiaowei_zhengnan.png"));
    nanzhao_shilin->xiaoweis->append(new CityXiaoWeiBean(45, 177, "正西校尉", ":/runshop/icon/runshop/xiaowei_zhengxi.png"));
    nanzhao->nextCitys->append(nanzhao_shilin);
    nanzhao->xiaoweis->append(new CityXiaoWeiBean(96, 42, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    nanzhao->xiaoweis->append(new CityXiaoWeiBean(272, 240, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    nanzhao->xiaoweis->append(new CityXiaoWeiBean(39, 254, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    allCitys->append(nanzhao);

    CityNode *miaojiang = new CityNode("苗疆", "miaojiang");
    CityNode *miaojiang_nanzhao = new CityNode("南诏","nanzhao", 67, 32);
    miaojiang_nanzhao->xiaoweis->append(new CityXiaoWeiBean(96, 42, "西北校尉", ":/runshop/icon/runshop/xiaowei_xibei.png"));
    miaojiang_nanzhao->xiaoweis->append(new CityXiaoWeiBean(272, 240, "东南校尉", ":/runshop/icon/runshop/xiaowei_dongnan.png"));
    miaojiang_nanzhao->xiaoweis->append(new CityXiaoWeiBean(39, 254, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    miaojiang->nextCitys->append(miaojiang_nanzhao);
    miaojiang->xiaoweis->append(new CityXiaoWeiBean(250, 45, "东北校尉", ":/runshop/icon/runshop/xiaowei_dongbei.png"));
    miaojiang->xiaoweis->append(new CityXiaoWeiBean(37, 251, "西南校尉", ":/runshop/icon/runshop/xiaowei_xinan.png"));
    miaojiang->xiaoweis->append(new CityXiaoWeiBean(281, 160, "正东校尉", ":/runshop/icon/runshop/xiaowei_zhengdong.png"));
    allCitys->append(miaojiang);

    CityNode *emei = new CityNode("峨眉山", "emei");
    emei->nextCitys->append(new CityNode("剑阁","jiange", 89, 156));
    allCitys->append(emei);

    CityNode *baozang_1 = new CityNode("宝藏洞", "baozang_1");
    baozang_1->nextCitys->append(new CityNode("敦煌","dunhuang", 234, 238));
    allCitys->append(baozang_1);

    CityNode *xingxiu = new CityNode("星宿海", "xingxiu");
    xingxiu->nextCitys->append(new CityNode("敦煌","dunhuang", 96, 159));
    allCitys->append(xingxiu);


    CityNode *tianshan = new CityNode("天山", "tianshan");
    tianshan->nextCitys->append(new CityNode("敦煌","dunhuang", 94, 158));
    allCitys->append(tianshan);
}

void CityManager::bfs(int vertex)
{
    // 队列，用于BFS
    QQueue<int>queue;
    queue.append(vertex);
    while (!queue.isEmpty()) {
        int v = queue.takeFirst();
        if (!allCitys->at(v)->isVisited) {
            allCitys->at(v)->isVisited = true;

            QList<int> unvisitedVertices;
            getUnvisitedVertex(v, unvisitedVertices);

            foreach(int uv, unvisitedVertices){
                queue.append(uv);
                dependencyMap[uv] = v;
            }
        }
    }
}

bool CityManager::getShortestPath(QString startEnName, QString endEnName, QList<CityNode *> *lines) {
    int start;
    int end;
    for(int i = 0 ; i < allCitys->size(); i++){
        CityNode *city =  allCitys->at(i);
        if(startEnName.contains(city->enName)){
            start = i;
        }
        if(endEnName.contains(city->enName)){
            end = i;
        }
    }
    if(start >= allCitys->size()){
        return false;
    }
    bfs(end);
    lines->append(allCitys->at(start));
    while (dependencyMap.value(start, -1) != -1) {
        lines->append(allCitys->at(dependencyMap.value(start)));
        start = dependencyMap.value(start);
    }
    return true;
}

// 找到未访问过的邻接点
void CityManager::getUnvisitedVertex(int i, QList<int> &unvisitedVertices) {
    for (int j = 0; j < CITY_LENGTH; j++) {
        if (matrix[i][j] > 0 && !allCitys->at(j)->isVisited) {
            unvisitedVertices.append(j);
        }
    }
}

void CityManager::initMatrix()
{
}


bool CityManager::getRunShop(QString startEnName, QString endEnName, QList<CityNode*> *leave, QList<CityNode *> *back)
{

    dependencyMap.clear();
    for(int i = 0 ; i < allCitys->size() ; i++){
        allCitys->at(i)->isVisited = false;
    }
    QList<CityNode *> nodes;
    if(!getShortestPath(startEnName, endEnName, &nodes)){
        return false;
    }
    getGroupLine(&nodes,leave);
    for(int i = 0 ; i < leave->size(); i++){
        CityNode *c = leave->at(i);
        qDebug() << c->name << c->x << "," << c->y;

    }
    qDebug() << "=======================";

    if(back != nullptr){
        for(int k = 0; k < (nodes.size()/2); k++){
            nodes.swapItemsAt(k, nodes.size()-k - 1);
        }

        getGroupLine(&nodes,back);

        for(int i = 0 ; i < back->size(); i++){
            CityNode *c = back->at(i);
            qDebug() << c->name << c->x << "," << c->y;

        }
        qDebug() << "*****************";
    }

}


void CityManager::getGroupLine(QList<CityNode *> *nodes, QList<CityNode *> *outCityLine)
{

    for(int i = 0; i < nodes->size() - 1 ; i++){
        CityNode *current = nodes->at(i);
        CityNode *next = nodes->at(i + 1);

        QList<CityNode *> *nextCitys= current->nextCitys;
        for(int i = 0; i < nextCitys->size(); i++){
            CityNode* n = nextCitys->at(i);
            if(n->enName == next->enName){
                outCityLine->append(n);
            }
        }
    }
}

CityNode* CityManager::getCityNodeByName(QString name){
    for(int i = 0 ; i < allCitys->size() ; i++){
        CityNode *cityNode = allCitys->at(i);
        if(cityNode->name == name){
            return cityNode;
        }
    }
    return nullptr;
}

CityNode* CityManager::getCityNodeByEnName(QString enName){
    for(int i = 0 ; i < allCitys->size() ; i++){
        CityNode *cityNode = allCitys->at(i);
        if(cityNode->enName == enName){
            return cityNode;
        }
    }
    return nullptr;
}

QStringList CityManager::getBigCitys()
{
    QStringList citys;
    return citys << "洛阳" << "苏州" << "大理";
}

/**
 * @brief getXiaoWeiBean
 * @param cityName 可以是中文也可以是拼音
 * @param xiaoWeiLocation
 * @return
 */
CityXiaoWeiBean* CityManager::getXiaoWeiBean(QString cityName, QString xiaoWeiLocation)
{
    for(CityNode * cityNode : *allCitys){
        if(cityNode->name == cityName || cityNode->enName == cityName){
            QList<CityXiaoWeiBean*> *xiaoweis = cityNode->xiaoweis;
            if(xiaoweis != nullptr){
                for(CityXiaoWeiBean *xiaowei : *xiaoweis){
                    if(xiaowei->xiaoWeiLocation == xiaoWeiLocation){
                        return xiaowei;
                    }
                }
            }
        }
    }
    return nullptr;
}

CityXiaoWeiBean* CityManager::getXiaoWeiBean(CityNode *cityNode, QString xiaoWeiLocation)
{
    if(cityNode == nullptr) return nullptr;
    QList<CityXiaoWeiBean*> *xiaoweis = cityNode->xiaoweis;
    if(xiaoweis == nullptr) return nullptr;
    for(int i = 0 ; i < xiaoweis->size(); i++){
        CityXiaoWeiBean * xiaoWeiBean = xiaoweis->at(i);
        if(xiaoWeiBean == nullptr) return nullptr;
        if(xiaoWeiBean->xiaoWeiLocation == xiaoWeiLocation){
            return xiaoWeiBean;
        }
    }
    return nullptr;
}

CityManager::~CityManager()
{
    qDeleteAll(allCitys->begin(), allCitys->end());
    allCitys->clear();
    delete  allCitys;
    allCitys = nullptr;

}
